import 'package:floor/floor.dart';
import 'package:share_fit/app/dao/dao_mixin.dart';
import 'package:share_fit/app/models/sports/pace_model.dart';

@dao
abstract class PaceDao with DaoMixin<PaceModel> {
  @override
  @Query('SELECT * FROM sports_pace WHERE _id = :id')
  Stream<PaceModel?> findById(int id);

  @override
  @Query('SELECT * FROM sports_pace')
  Future<List<PaceModel>> findAll();

  @override
  @Query('SELECT * FROM sports_pace')
  Stream<List<PaceModel>> findAllAsStream();

  @override
  @Query('delete FROM sports_pace')
  Future<void> deleteAll();

  @Query('SELECT * FROM sports_pace WHERE date_created >= :startTime and date_created < :endTime')
  Future<List<PaceModel>> findBy(int startTime, int endTime);

  @Query('delete FROM sports_pace where address = :address')
  @override
  Future<void> deleteAllByAddress(String address);
}
